home *** CD-ROM | disk | FTP | other *** search
- #include <Types.h>
- #include <StdIO.h>
-
- #define numRdArgs 2 /* Number of arguments for read command. */
- #define numWrArgs 3 /* Number of arguments for write command. */
-
- #define kCommandArg 0
- #define kAddrArg 1
- #define kDataArg 2
-
- typedef unsigned long ulong ;
-
- //
- // Main()
- //
- unsigned main(ulong argC, char *argV[])
-
- {
- ulong status = noErr;
-
- if ((argC >= 2) && (argC <= 3))
- {
- ulong *address;
-
- sscanf(argV[kAddrArg],"%i", &address);
-
- if(true /*IN_RANGE(address, VBLInt, CurLine)*/)
- {
- ulong writeValue, readValue ;
-
- switch(argC)
- {
- case numRdArgs:
- readValue = *address ;
-
- fprintf(stdout,"$%p -> $%08X (%d)\n",
- address, readValue, readValue);
- break;
-
- case numWrArgs:
- sscanf(argV[kDataArg],"%i",&writeValue);
- *address = writeValue ;
- fprintf(stdout,"$%p <- $%08X (%d)\n",
- address, writeValue, writeValue);
- break;
-
- default:
- status++;
- break;
- }
- }
- else
- status++;
- }
- else
- status++;
-
- if (status != noErr)
- fprintf(stdout,"# Usage %s - address [value].\n", argV[kCommandArg]);
-
- return(status);
- }
-